
package com.example.administrator.shandon2020_1;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

import com.example.administrator.shandon2020_1.util.SaveandGet;

public class setting extends AppCompatActivity {
    private EditText et_ip,et_username,et_password,et_id,et_fan_Do,et_fan_id,et_temp_id;
    private EditText et_rate;
    private Button btn_save,btn_close;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_setting);
        init();
        btn_save.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                SaveandGet.save(et_ip.getText().toString(),et_username.getText().toString(),et_password.getText().toString(),et_id.getText().toString(),et_temp_id.getText().toString(),et_fan_id.getText().toString(),et_rate.getText().toString().trim(),
                        et_fan_Do.getText().toString(),setting.this);
                Intent intent=new Intent(setting.this,MainActivity.class);
                startActivity(intent);
            }
        });
        btn_close.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent=new Intent(setting.this,MainActivity.class);
                startActivity(intent);
            }
        });
    }
    private void init(){
        et_ip=findViewById(R.id.et_ip);
        et_username=findViewById(R.id.et_username);
        et_password=findViewById(R.id.et_password);
        et_id=findViewById(R.id.et_id);
        et_fan_Do=findViewById(R.id.et_fanDo);
        et_fan_id=findViewById(R.id.et_fan_id);
        et_temp_id=findViewById(R.id.et_temp_id);
        et_rate=findViewById(R.id.et_rate);
        btn_close=findViewById(R.id.close);
        btn_save=findViewById(R.id.save);
    }
}
